﻿@{
    Layout = null;
    var consumeItemList = ViewData["consumeItemList"] as List<Pay.DTO.app_consume_item_dto>;
    var ad = ViewData["ad"] as Pay.DTO.ad_dto;
    string site_img = ViewBag.img_url;
    long userId = ViewBag.user_id;
}

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>消费</title>
    <meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0,maximum-scale=1.0, user-scalable=no" />
    <link rel="stylesheet" href="~/Content/css/base.css" />
    <link rel="stylesheet" href="~/Content/css/tuoken.css" />
    <script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
    <script type="text/javascript" src="~/Content/js/base.js"></script>
</head>

<body>
    @*<div class="header">
        <div class="hdtitle">
            消费
        </div>
    </div>*@
    <div class="bodyct">
        <div class="consumption_banner" style="background:url(@(ad != null ? site_img + ad.img_url : "images/consumptionbg.png"));background-size:100%"
             onclick="@((ad != null && !string.IsNullOrEmpty(ad.link_url)) ? string.Format("clickAd('{0}','{1}')", ad.id,ad.link_url) : "")">
        </div>

        <div class="expense_pd">
            @if (consumeItemList != null && consumeItemList.Count() > 0) {
                foreach (var model in consumeItemList) {
                    if (model.consume_type == 6) {
                        <div class="expenselink">
                            <a href="@(userId>0?(!string.IsNullOrEmpty(model.url) ? model.url : "javascript:void(0);"):"/home/login")">
                                <img src="@(site_img + model.img_url)" alt="" >
                            </a>
                        </div>
                    } else {
                        <div class="expenselink">
                            <a href="@(!string.IsNullOrEmpty(model.url) ? model.url : "javascript:void(0);")">
                                <img src="@(site_img + model.img_url)" alt="" >
                            </a>
                        </div>
                    }

                }
            }


            @*<div class="more_fast">更多功能正在开发中…</div>*@
        </div>
    </div>
    <!--底部-->
    <div class="footer">
        <a href="/Home/Index">
            <i></i>
            <span>基地</span>
        </a>
        <a href="/DistributionMall/Index">
            <i></i>
            <span>云商城</span>
        </a>
        <a href="/ProductTokenMaker/Index">
            <i></i>
            <span>创客导购</span>
        </a>
        @*<a href="/Task/List">
            <i></i>
            <span>任务</span>
        </a>
        <a href="/Consumption/Index" class="on">
            <i></i>
            <span>发现</span>
        </a>*@
        <a href="/User/My">
            <i></i>
            <span>我的</span>
        </a>
    </div>
    <script>
        //点击广告，记录点击数
        function clickAd(id, url) {
            $.ajax({
                url: '@Url.Action("GetAd","Ad")',
                async: false,
                type: 'POST',
                data: { id: id },
                success: function (result) {
                    window.location.href = url;
                }
            });
        }

        $('.footer a').click(function () {
            $(this).addClass('on').siblings().removeClass('on');
        });
    </script>
</body>

</html>